1. Field of the Invention
The present invention relates to a software analysis apparatus and method for analyzing a computer program to help the user easily understand the contents of the computer program, and a recording medium that stores a program for implementing such functions.
2. Description of the Related Art
When a large number of programmers develop a large-scale program in collaboration or maintain a program already in existence, they must understand a program written by other programmers. However, it is often difficult for a given programmer to understand a program written by another programmer. Also, in the process of developing a program, a programmer must often check a portion that was developed by himself or herself in the past. However, as the program scale becomes larger, the load of the programmer increases even upon checking a program written by himself or herself.
Conventionally, an apparatus which provides various kinds of information by automatically analyzing program source code to help understand a program has been proposed. For example, a conventional apparatus and method for generating a call graph or flow graph by analyzing program source code to allow a programmer to visually recognize the program have been proposed and are disclosed in, e.g., Japanese Patent Application Nos. 9-32415, 9-32452, previously filed by the present applicant.
Note that the “call graph” shows a calling relationship among procedures (“functions” in C) that compose a program. Nodes of this graph represent procedures, and edges represent the calling relationship among the procedures. When this call graph is graphically displayed, the programmer not only can visually recognize the calling relationship among the procedures but also can easily understand the structured level and contents of a program or can easily detect an unwanted procedure call.
On the other hand, the “flow graph” shows the flow of control in a given procedure. Nodes of this graph represent fundamental blocks (each consisting of a continuous sentence sequence, and after control shifts to the first sentence, it reaches to the last sentence without any halt or branch in the middle of execution), and edges represent the flow of control among the fundamental blocks. As for this flow graph, when its information is graphically displayed, the control flow in that procedure can be visually recognized, and unwanted control flow can be easily detected.
However, when a large-scale program, e.g., a program including more than million steps is to be analyzed, the volume of analysis information required for program analysis also becomes very large. For this reason, the maximum memory capacity (main storage device used as a work memory) that a normal workstation or personal computer can mount is insufficient for all pieces of analysis information, or the time required for analysis becomes very long.
For example, when the memory capacity becomes short during analysis, and no more analysis information can be stored in a memory, analysis for the remaining program cannot be done. In such case, after some measure is taken, e.g., the program to be analyzed is segmented or re-formed into some pieces, the program must be analyzed again from the beginning, resulting in poor analysis efficiency.
When the program to be analyzed is segmented into some pieces, analysis that must be done over the entire program, e.g., influence analysis which detects the influence of a change in value of a given variable in the program on other parts cannot yield appropriate analysis information.
Furthermore, analysis may be interrupted due to some cause other than memory shortage during program analysis. In such case, the analysis results previously obtained cannot be used, and program analysis must be redone from the beginning, resulting in poor analysis efficiency.